import { Fragment } from '@/components/Fragment';
import { Text } from '@aws-amplify/ui-react';
import { TextDemo, TextStylingSample } from './demo';
import { Example, ExampleCode } from '@/components/Example';
import { ComponentStyleDisplay } from '@/components/ComponentStyleDisplay';
import ThemeExample from '@/components/ThemeExample.mdx';
import {
DefaultTextExample,
GlobalStylingExample,
LocalStylingExample,
TextTruncatedExample,
TextVariationExample,
TextThemeExample,
} from './examples';
## Demo
## Usage
Import the Text primitive.
```jsx file=./examples/DefaultText.tsx
```
### Variations
Use the `variation` prop to change the Text variation. Available options are `primary`, `secondary`, `tertiary`, `error`, `warning`, `info`, and `success`.
```jsx file=./examples/TextVariation.tsx
```
### Truncate
The `isTruncated` prop will render an ellipsis when the text exceeds the defined width.
```jsx file=./examples/TextTruncated.tsx
```
## CSS Styling
```tsx file=./examples/TextThemeExample.tsx
```
### Target classes
### Global styling
To override styling on all Text, you can set the Amplify CSS variables or use the built-in `.amplify-text` class.
(Revise this example)
```css
/* styles.css */
.amplify-text {
--amplify-components-text-color-primary: var(--amplify-colors-red-80);
}
```
```jsx file=./examples/GlobalStyling.tsx
```
### Local styling
To override styling on a specific Text, you can use a class selector or style props.
_Using a class selector:_
This is my styled text
```css
/* styles.css */
.styled-text {
font-weight: var(--amplify-font-weights-bold);
color: var(--amplify-colors-red-80);
text-decoration: underline;
}
```
```jsx
import './styles.css';
This is my styled text;
```
_Using style props:_
```jsx file=./examples/LocalStyling.tsx
```